package com.yyx.app1.My_function.Controls.ViewPager;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.yyx.app1.My_function.Controls.MyAppointment.Item_Appointment_All_Adapter;
import com.yyx.app1.My_function.Controls.MyAppointment.Item_Appointment_Appointment_Adapter;
import com.yyx.app1.My_function.Controls.MyAppointment.Item_Appointment_End_Adapter;
import com.yyx.app1.My_function.Controls.MyQuestion.Item_Question_All_Adapter;
import com.yyx.app1.My_function.Controls.MyQuestion.Item_Question_NoBeginning_Adapter;
import com.yyx.app1.My_function.Controls.MyQuestion.Item_Question_Progress_Adapter;
import com.yyx.app1.R;

import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

/**
 * Created by yuexing on 2015/10/23.
 */
@EViewGroup(R.layout.item_viewpager_all)
public class ListView_ViewPagerOfChild extends LinearLayout {
    private Context context;

    @ViewById
    ListView listview;

    public ListView_ViewPagerOfChild(Context context) {
        super(context);
        this.context = context;
    }

    public ListView_ViewPagerOfChild(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    public ListView_ViewPagerOfChild(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
    }

    public void init(String str)
    {
        listview.setOverScrollMode(OVER_SCROLL_NEVER);
        if (str.equals("question_all"))
        {
            Item_Question_All_Adapter adapter= new Item_Question_All_Adapter(context);
            adapter.findAll();
            listview.setAdapter(adapter);
        }
        else if (str.equals("question_run"))
        {
            Item_Question_Progress_Adapter adapter = new Item_Question_Progress_Adapter(context);
            adapter.findAll();
            listview.setAdapter(adapter);
        }
        else if(str.equals("question_unstart"))
        {
            Item_Question_NoBeginning_Adapter adapter = new Item_Question_NoBeginning_Adapter(context);
            adapter.findAll();
            listview.setAdapter(adapter);
        }
        else if (str.equals("appointment_all"))
        {
            Item_Appointment_All_Adapter adapter = new Item_Appointment_All_Adapter(context);
            adapter.findAll();
            listview.setAdapter(adapter);
        }
        else if (str.equals("appointment_unstart"))
        {
            Item_Appointment_Appointment_Adapter adapter = new Item_Appointment_Appointment_Adapter(context);
            adapter.findAll();
            listview.setAdapter(adapter);
        }
        else if (str.equals("appointment_over"))
        {
            Item_Appointment_End_Adapter adapter = new Item_Appointment_End_Adapter(context);
            adapter.findAll();
            listview.setAdapter(adapter);
        }
    }
}
